package com.cn.hnust.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cn.hnust.dao.ScenicMapper;
import com.cn.hnust.pojo.Scenic;
import com.cn.hnust.service.IScenicService;
import com.cn.hnust.util.Page;

@Service("scenicService")
public class ScenicServiceImpl implements IScenicService {

	@Autowired
	private ScenicMapper scenicDao;

	
	public Scenic getUserById(Integer userId) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	
	public List<Scenic> getUsers() {
		// TODO Auto-generated method stub
		return scenicDao.getUsers();
	}

	
	public Scenic getUser(int id) {
		// TODO Auto-generated method stub
		
		return scenicDao.getUser(id);
	}

	
	public int insert(Scenic user) {
		// TODO Auto-generated method stub
		if (user != null) {
			return scenicDao.insert(user);
		}
		return 0;
	}

	
	public int delscenic(Integer id) {
		// TODO Auto-generated method stub
		int a = scenicDao.deleteByPrimaryKey(id);
		if (a < 0) {
			return 0;

		} else {
			return scenicDao.deleteByPrimaryKey(id);
		}

	}

	
	public List<Scenic> selectPersons(String scenic_name,Page page) {
		// TODO Auto-generated method stub
		List scenic = scenicDao.selectPersons(scenic_name,page);
		if (scenic != null) {
			return scenicDao.selectPersons(scenic_name,page);
		} else {
			return null;
		}
	}

	
	public List<Scenic> queryAllRecord(Page page) {
		// TODO Auto-generated method stub
		
		
		return scenicDao.queryAllRecord(page);
	}

	
	public int getCount() {
		// TODO Auto-generated method stub
		
		return scenicDao.getCount();
	}

	
	public int updateByPrimaryKey(Scenic record) {
		// TODO Auto-generated method stub
		int a=scenicDao.updateByPrimaryKey(record);
		if(a>1){
			return scenicDao.updateByPrimaryKey(record);
		}else{
			return 0;
		}
		
	}

	
	public int getCountmh(String scenic_name) {
		// TODO Auto-generated method stub
		scenicDao.getCountmh(scenic_name);
		return scenicDao.getCountmh(scenic_name);
	}

	
	public List<Scenic> queryReception() {
		// TODO Auto-generated method stub
		
		return scenicDao.queryReception();
	}


	@Override
	public List<Scenic> getScenic_dq(String scenic_dq) {
		// TODO Auto-generated method stub
		return scenicDao.getScenic_dq(scenic_dq);
	}
}